<?php
 
//连接redis数据库
$redis = new Redis();
$redis->connect('127.0.0.1',6379);
$key = 'secKill3';

$num = $redis->LLEN($key);

echo "num=".$num;exit;

while(1) {
    //从队列最前头取出一个值
    $uid = $redis->lPop($key);
    //判断值是否存在
    if(!$uid || $uid == 'nil'){
        /*sleep(2);
        continue;*/
        break;//不用死循环
    }
    echo "uid=".$uid."<br>";
    //数据库插入数据失败,回滚
   /* if(!$res){
        $redis->rPush($key,$uid);
    }*/
}
 